using System;
using System.Collections.Generic;

namespace AutoTest.Core.Domain
{
    public class TestRunCompletedMessage
    {
        public int NumberOfTestsRun;
        public int NumberOfFailures;
        public IList<TestFailure> Failures = new List<TestFailure>();
        public string Output { get; set; }

        public bool Success
        {
            get { return NumberOfTestsRun > 0 && NumberOfFailures == 0; }
        }

        public string FailureSummary
        {
            get
            {
                var s = "";
                for (int i = 0; i < 3 && i < Failures.Count; i++)
                {
                    s += Failures[i].TestName + Environment.NewLine;
                    s += "    " + Failures[i].ShortMessage + Environment.NewLine;
                    s += Environment.NewLine;
                }
                return s;
            }
        }
    }
}